/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2020-11-04
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
/*----------------------------Head file----------------------------*/

#ifndef _APP_STORE_SET_INFO_H_
#define _APP_STORE_SET_INFO_H_

#include "stdbool.h"
#include "stdint.h"
#include "app_global_data.h"

/*----------------------------macro file---------------------------*/

#define APP_DEVICE_NAME_MAX_LEN 18

#define DEV_MAC_LEN             6
#define TIMEZONE_MINS_MAX_VAL   (12*60)
#define NEG_TIMEZONE_MASK       0x8000
#define NEG_MINS_MIN_VAL        NEG_TIMEZONE_MASK
#define NEG_MINS_MAX_VAL        (NEG_TIMEZONE_MASK + TIMEZONE_MINS_MAX_VAL)
#define INT_MINS_MIN_VAL        0
#define INT_MINS_MAX_VAL        TIMEZONE_MINS_MAX_VAL

/*----------------------------var define---------------------------*/

/*----------------------------type define--------------------------*/
typedef struct{
    uint16_t        valid_chk;
    app_user_info_t set;
    uint16_t        checksum;
    } user_info_t;

    typedef struct{
    uint16_t        valid_chk;
    uint8_t         mac[6];
    uint16_t        checksum;
    } burn_mac_t;

    typedef struct{
    uint16_t        valid_chk;
    uint8_t         name_len;
    uint8_t         name[APP_DEVICE_NAME_MAX_LEN];
    uint16_t        checksum;
} ble_adv_name_t;

/*-------------------------func declaration------------------------*/
extern void app_set_info_init(void);
extern void app_set_info_revert(void);
extern void app_set_info_local_timezone_save(uint16_t timezone_min);
extern void app_set_info_countdown_time_save(uint16_t secs);
extern void app_set_info_coutdown_num_save(uint16_t cnt);
extern void app_set_info_burn_mac_save(uint8_t* mac, uint8_t len);
extern uint8_t app_set_info_burn_mac_get(uint8_t* mac);
extern bool app_set_info_ble_adv_name_save(uint8_t* name, uint8_t len);
extern uint8_t app_set_info_ble_adv_name_get(uint8_t* name);

/*-----------------------------------------------------------------*/


#endif
